﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:system="clr-namespace:System;assembly=mscorlib">
	<system:Double x:Key="CloseButtonWidthAndHeight">14</system:Double>
	<Geometry x:Key="XCloseButton">M0,0 L10,10 M0,10 L10,0</Geometry>
	<Color x:Key="TabItemForegroundColorBase">#4971A3</Color>
	<SolidColorBrush x:Key="TabItemCloseButtonNormalForegroundBrush" Color="{StaticResource TabItemForegroundColorBase}"/>
	<SolidColorBrush x:Key="TabItemCloseButtonHoverForegroundBrush" Color="White"/>
	<SolidColorBrush x:Key="TabItemCloseButtonPressedForegroundBrush" Color="#EEEE"/>
	<LinearGradientBrush x:Key="TabItemCloseButtonNormalBackgroundBrush" StartPoint="0,0" EndPoint="1,0">
		<GradientBrush.GradientStops>
			<GradientStopCollection>
				<GradientStop Color="#5FFF" Offset="0.0"/>
				<GradientStop Color="#5CCC" Offset="1.0"/>
			</GradientStopCollection>
		</GradientBrush.GradientStops>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="TabItemCloseButtonNormalBorderBrush" StartPoint="0,0" EndPoint="1,1">
		<GradientBrush.GradientStops>
			<GradientStopCollection>
				<GradientStop Color="#5CCC" Offset="0.0"/>
				<GradientStop Color="#5444" Offset="1.0"/>
			</GradientStopCollection>
		</GradientBrush.GradientStops>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="TabItemCloseButtonHoverBackgroundBrush" StartPoint="0,1" EndPoint="1,0">
		<GradientBrush.GradientStops>
			<GradientStopCollection>
				<GradientStop Color="#FFDF2B1E" Offset="0.0"/>
				<GradientStop Color="#FFA41F00" Offset="1.0"/>
			</GradientStopCollection>
		</GradientBrush.GradientStops>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="TabItemCloseButtonPressedBackgroundBrush" StartPoint="0,0" EndPoint="1,1">
		<GradientBrush.GradientStops>
			<GradientStopCollection>
				<GradientStop Color="#FFA41F00" Offset="0.0"/>
				<GradientStop Color="#FFDF2B1E" Offset="1.0"/>
			</GradientStopCollection>
		</GradientBrush.GradientStops>
	</LinearGradientBrush>
	<LinearGradientBrush x:Key="TabItemCloseButtonPressedBorderBrush" StartPoint="0,0" EndPoint="1,1">
		<GradientBrush.GradientStops>
			<GradientStopCollection>
				<GradientStop Color="#5444" Offset="0.0"/>
				<GradientStop Color="#5CCC" Offset="1.0"/>
			</GradientStopCollection>
		</GradientBrush.GradientStops>
	</LinearGradientBrush>
	<Style x:Key="TabItemCloseButtonStyle" TargetType="{x:Type Button}">
		<Setter Property="SnapsToDevicePixels" Value="false"/>
		<Setter Property="Height" Value="{StaticResource CloseButtonWidthAndHeight}"/>
		<Setter Property="Width" Value="{StaticResource CloseButtonWidthAndHeight}"/>
		<Setter Property="Cursor" Value="Hand"/>
		<Setter Property="Focusable" Value="False"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Border x:Name="ButtonBorder"
							CornerRadius="2"
							BorderThickness="1"
							Background="{StaticResource TabItemCloseButtonNormalBackgroundBrush}"
							BorderBrush="{StaticResource TabItemCloseButtonNormalBorderBrush}">
						<Grid>
							<!-- The Path below will render the button's X. -->
							<Path x:Name="ButtonPath"
								  Margin="2"
								  Data="{StaticResource XCloseButton}"
								  Stroke="{StaticResource TabItemCloseButtonNormalForegroundBrush}"
								  StrokeThickness="2"
								  StrokeStartLineCap="Round"
								  StrokeEndLineCap="Round"
								  Stretch="Uniform"
								  VerticalAlignment="Center"
								  HorizontalAlignment="Center"/>
							<!-- We don't really need the ContentPresenter, but what the heck ... -->
							<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource TabItemCloseButtonHoverBackgroundBrush}" />
							<Setter TargetName="ButtonPath" Property="Stroke" Value="{StaticResource TabItemCloseButtonHoverForegroundBrush}"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Visibility" Value="Collapsed"/>
						</Trigger>
						<Trigger Property="IsPressed" Value="true">
							<Setter TargetName="ButtonBorder" Property="Background" Value="{StaticResource TabItemCloseButtonPressedBackgroundBrush}" />
							<Setter TargetName="ButtonBorder" Property="BorderBrush" Value="{StaticResource TabItemCloseButtonPressedBorderBrush}" />
							<Setter TargetName="ButtonPath" Property="Stroke" Value="{StaticResource TabItemCloseButtonPressedForegroundBrush}"/>
							<Setter TargetName="ButtonPath" Property="Margin" Value="2.5,2.5,1.5,1.5" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>